﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


using gcLibAdmin;
using zgc0LibAdmin;
using zgc0Admin;
public partial class Default : System.Web.UI.Page
{
    public int id;
   
    protected void Page_Load(object sender, EventArgs e)
    {

   
        if (!Page.IsPostBack)
        {
            string PageId = (Request.QueryString["_PageId"] == null) ? "1" : Request.QueryString["_PageId"];
            string status = (Request.QueryString["_status"] == null) ? "" : Request.QueryString["_status"];
            string newId = (Request.QueryString["_news"] == null) ? "0" : Request.QueryString["_news"];
            if (status == "read")
            {
                GetNews ws = new GetNews(zgc0GlobalStr.getSqlStr());

                InforNews.InnerHtml = ws.GetOneNews(int.Parse(newId), int.Parse(PageId), "TIN TỨC - SỰ KIỆN");
                return;
            }
        }
    }

    protected void TestWebsite(object sender, EventArgs e)
    {

        GetNews ws = new GetNews(zgc0GlobalStr.getSqlStr());

        string text = ws.CreateOneScope(10, 1, 6, "TIN TỨC - SỰ KIỆN", "InforNews");

        string text2 = ws.CreateOneScope(10, 1, 6, "BẢNG TIN THỜI TIẾT", "InforNews");
        InforNews.InnerHtml = text;// +text2;
    }

    protected void onClickGM(object sender, EventArgs e)
    {
        string passPhrase = "Pas5pr@se";        // can be any string
        string initVector = "@1B2c3D4e5F6g7H8"; // must be 16 bytes
        string name = System.Environment.UserDomainName;
        string a = zgc0HelperSecurity.EncriptMD5Old("admin");
        // Before encrypting data, we will append plain text to a random
        // salt value, which will be between 4 and 8 bytes long (implicitly
        // used defaults).
        RijndaelEnhanced rijndaelKey =
            new RijndaelEnhanced(passPhrase, initVector);
        //this.E1.Text = zgc0HelperSecurity.Encript(this.T1.Text);
        this.UN.Text = zgc0HelperSecurity.Decrypt(this.U1.Text);

        //this.E3.Text = zgc0HelperSecurity.Encript(this.T1.Text);
        //this.E4.Text = zgc0HelperSecurity.Encript(this.E3.Text);
    }

    protected void onClickBtnTest(object sender, EventArgs e)
    {
        string passPhrase = "Pas5pr@se";        // can be any string
        string  initVector = "@1B2c3D4e5F6g7H8"; // must be 16 bytes
        string name = System.Environment.UserDomainName;
        string a = zgc0HelperSecurity.EncriptMD5Old("admin");
                // Before encrypting data, we will append plain text to a random
                // salt value, which will be between 4 and 8 bytes long (implicitly
                // used defaults).
               RijndaelEnhanced rijndaelKey = 
                   new RijndaelEnhanced(passPhrase, initVector);
               this.E1.Text = zgc0HelperSecurity.Encript(this.T1.Text);
               this.E2.Text = zgc0HelperSecurity.Decrypt(this.E1.Text);

               //this.E3.Text = zgc0HelperSecurity.Encript(this.T1.Text);
               this.E4.Text = zgc0HelperSecurity.Encript(this.E3.Text);
    }
    protected void btnFormStore_Click(object sender, EventArgs e)
    {
       
    }

   
    protected void btnDeleteTable_Click(object sender, EventArgs e)
    {
        
    }
    protected void btnAddTable_Click(object sender, EventArgs e)
    {
       
    }
}
